package com.syl;

import java.util.List;

import com.melloware.jintellitype.HotkeyListener;
import com.melloware.jintellitype.JIntellitype;
import com.syl.bean.VisitedUrl;
import com.syl.dao.VisitedUrlDao;
import com.syl.util.DbHelp;

public class Test implements HotkeyListener {
	static final int KEY_1 = 88; 

	public static void main(String[] args) {
        /*initHotkey(); 

        //下面模拟长时间执行的任务 
        while (true) {
            try { 
            	System.out.println("==========================");
                Thread.sleep(1000);
            } catch (Exception ex) {
                break;
            }
        }*/
		
		DbHelp db = new DbHelp();
		VisitedUrlDao dao = db.getDao(VisitedUrlDao.class);
		List<VisitedUrl> all = dao.getSome("2");
		System.out.println(all);
	}

	@Override
	public void onHotKey(int identifier) {
		// TODO Auto-generated method stub
		switch (identifier) {
		case KEY_1: 
			System.out.println("alt+I 按下........."); 

			JIntellitype.getInstance().unregisterHotKey(KEY_1);
			System.exit(0);
			break;
		}
	}
	
	static void initHotkey() {
		JIntellitype.getInstance().registerHotKey(KEY_1, JIntellitype.MOD_ALT, (int) 'P');
		
		JIntellitype.getInstance().addHotKeyListener(new Test());
	}

}
